package ogdkp.providers;

import ogdkp.om.Loot;
import ogdkp.om.Player;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

public class DKPLabelProvider extends LabelProvider implements ITableLabelProvider {

	@Override
	public String getColumnText(final Object obj, final int index) {
		if (obj instanceof Player) {
			final Player player = (Player) obj;
			switch (index) {
			case 0:
				return player.getName();
			case 1:
				return player.getClassName();
			case 2:
				return player.getStartingDKP() + "";
			case 3:
				return player.getSpentDKP() + "";
			case 4:
				return player.getCurrentDKP() + "";
			}
		} else if (obj instanceof Loot) {
			final Loot loot = (Loot) obj;
			switch (index) {
			case 0:
				return loot.getName();
			case 3:
				return loot.getCost() + "";
			}
		}
		return "";
	}

	@Override
	public Image getColumnImage(final Object obj, final int index) {
		return null;
	}

}
